package com.lxj.stream;

import java.io.File;
import java.io.FileInputStream;

/**
 * TestStream4
 */
public class TestStream4 {

    public static void main(String[] args) {
        File f = new File("f:/xyz/abc/def/lol2.txt");

        try(FileInputStream fis = new FileInputStream(f)) {
            byte[] all = new byte[(int) f.length()];
            fis.read(all);
            // 
            System.out.println("文件中读取出来的数据是: ");

            for (byte b : all) {
                int i = b&0x000000ff;
                System.out.println(Integer.toHexString(i));
            }

            System.out.println("把这个数字,放在UTF-8棋盘上面");

            String str = new String(all, "UTF-8");

            System.out.println(str);
        } catch (Exception e) {
            e.printStackTrace();
            //TODO: handle exception
        }

    }
}